<!-- 企业编辑弹窗 -->
<template>
  <ele-modal
    form
    :width="640"
    :model-value="modelValue"
    title="查看报价图片"
    @update:modelValue="updateModelValue"
  >
    <el-form ref="formRef" label-width="80px">
      <el-form-item label="图片">
        <image-upload :limit="10" v-model="imagesList" :read-only="true" />
      </el-form-item>
    </el-form>
  </ele-modal>
</template>

<script setup>
  import { ref, watch } from 'vue';
  import ImageUpload from '@/components/ImageUpload/index.vue';

  const emit = defineEmits(['done', 'update:modelValue']);

  const props = defineProps({
    /** 弹窗是否打开 */
    modelValue: Boolean,
    /** 修改回显的数据 */
    data: Object
  });

  /** 表单实例 */
  const formRef = ref(null);
  const imagesList = ref(null);

  /** 更新modelValue */
  const updateModelValue = (value) => {
    emit('update:modelValue', value);
  };

  watch(
    () => props.modelValue,
    (modelValue) => {
      if (modelValue) {
        imagesList.value = props.data.images;
      } else {
        console.log('无');
      }
    }
  );
</script>
